package com.aplink.generic.pojo.controlspec;

import com.aplink.generic.pojo.ObjectFilter;
import com.aplink.generic.util.AndroidUIParser;
import com.aplink.generic.util.objectrule.TargetRuleCollection;

import java.util.ArrayList;
import java.util.List;

public class GridViewSpec extends ControlSpec {
    private String mRowItem;
    private String mRptrdesign;
    private String mContentData;
    private String mDataObject;
    private ObjectFilter mFilter;
    private List<GridViewSpec.GridViewItem> mGalleryItems;
    private TargetRuleCollection mTargetRuleCollection;

    public String getRowItem() {
        return mRowItem;
    }

    public String getDataObject() {
        return mDataObject;
    }

    public void setDataObject( String dataObject ) {
        mDataObject = dataObject;
    }

    public ObjectFilter getFilter() {
        return mFilter;
    }

    public void setFilter( ObjectFilter filter ) {
        mFilter = filter;
    }

    public List<GridViewSpec.GridViewItem> getGalleryItems() {
        return mGalleryItems;
    }

    public void setGalleryItems(
            List<GridViewSpec.GridViewItem> galleryItems ) {
        mGalleryItems = galleryItems;
    }

    public void setRowItem( String rowItem ) {
        mRowItem = rowItem;
    }

    public String getRptrdesign() {
        return mRptrdesign;
    }

    public void setRptrdesign( String rptrdesign ) {
        mRptrdesign = rptrdesign;
    }

    public String getContentData() {
        return mContentData;
    }

    public void setContentData( String contentData ) {
        mContentData = contentData;
    }

    public TargetRuleCollection getTargetRuleCollection() {
        return mTargetRuleCollection;
    }

    public void setTargetRuleCollection(
            TargetRuleCollection targetRuleCollection ) {
        mTargetRuleCollection = targetRuleCollection;
    }

    public int getIdRptrDesign() {
        return AndroidUIParser.getRawIdByName( this.mRptrdesign );
    }

    public int getIdContentData() {
        return AndroidUIParser.getRawIdByName( this.mContentData );
    }

    public void add( GridViewItem galleryItem ) {
        mGalleryItems.add( galleryItem );
    }

    public GridViewSpec() {
        mGalleryItems = new ArrayList<GridViewSpec.GridViewItem>();
    }

    public class GridViewItem {
        private String mDataObject;
        private String mMappingName;
        private String mFilter;

        public GridViewItem() {
            super();
        }

        public GridViewItem( String mappingName, String dataObject ) {
            super();
            this.mMappingName = mappingName;
            this.mDataObject = dataObject;
        }

        public GridViewItem( String dataObject, String mappingName, String filter ) {
            super();
            mDataObject = dataObject;
            mMappingName = mappingName;
            mFilter = filter;
        }

        public String getDataObject() {
            return this.mDataObject;
        }

        public String getMappingName() {
            return this.mMappingName;
        }

        public void setDataObject( String dataObject ) {
            this.mDataObject = dataObject;
        }

        public void setMappingName( String mappingName ) {
            this.mMappingName = mappingName;
        }

        public String getFilter() {
            return mFilter;
        }

        public void setFilter( String filter ) {
            mFilter = filter;
        }
    }
}
